package com.itany.cloud.util;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/8/9 14:00
 * Version:1.0-SNAPSHOT
 * Description:
 */
@ApiModel("JSON对象")
public class ResponseResult implements Serializable {

    @ApiModelProperty("业务逻辑状态码")
    private String responseCode;
    @ApiModelProperty("响应的消息")
    private String message;
    @ApiModelProperty("响应的对象")
    private Object returnObject;

    public static ResponseResult success(){
        ResponseResult result = new ResponseResult();
        result.setResponseCode("2001");
        result.setMessage("成功");
        return result;
    }

    public static ResponseResult success(Object obj){
        ResponseResult result = new ResponseResult();
        result.setResponseCode("2001");
        result.setMessage("成功");
        result.setReturnObject(obj);
        return result;
    }

    public static ResponseResult fail(String message){
        ResponseResult result = new ResponseResult();
        result.setResponseCode("2002");
        result.setMessage(message);
        return result;
    }

    public String getResponseCode() {
        return responseCode;
    }

    public void setResponseCode(String responseCode) {
        this.responseCode = responseCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getReturnObject() {
        return returnObject;
    }

    public void setReturnObject(Object returnObject) {
        this.returnObject = returnObject;
    }
}
